package com.scalar.chiptrack.finance.proformainvoice;

import com.scalar.chiptrack.utils.StringUtils;

import java.io.Serializable;

/**
  * User: prasad
 * Date: Nov 7, 2007
 */

public class ProformaInvoiceLineItem  implements Serializable
{
    private int invoiceId           = -1;
    private String invoiceNo        = "";
    private String invoiceDate      = "";


    private int proInvoiceLineItemId= -1;
    private int lineItemId          = -1;
    private int salesOrderId        = -1;
    private int productId           = -1;
    private int lineItemNo;
    private int poLineItemNo;
    private int quantity;
    private int qtyPulled;
    private int qtyAvailable;
    private int totalInvoicedQty;

    private float unitPrice         = 0.0f;
    private float amount            = 0.0f;

    private double unitPriceAsDouble= 0.0;
    private double amountAsDouble   = 0.0;

    private double discountPrice    = 0.0d;
    private double discountAmount   = 0.0d;

    private String salesOrderNo         = null;
    private String labelNumber          = null;
    private String marketingPartNo      = null;
    private String manufacturingPartNo  = null;
    private String lineItemDescription  = null;
    private String requestDate          = null;
    private String bookingDate          = null;
    private String scheduleDate         = null;
    private String revisedDate          = null;
    private String shippedDate          = null;
    private String status               = null;
    private String customerPO           = null;
    private String customerName         = null;
    private String uom	                = null;
    private String eccn	                = null;
    private String licenseException     = null;
    private String customerPartNo       = null;
    private String description          = null;

    private boolean cancel          = false;
    private boolean close           = false;
    private boolean hold            = false;
    private boolean taxable         = false;
    private boolean zeroPrice       = false;
    private boolean transfer        = false;
    private boolean selected        = false;


    public ProformaInvoiceLineItem() { }


    public int getInvoiceId() {
        return invoiceId;
    }

    public void setInvoiceId(int invoiceId) {
        this.invoiceId = invoiceId;
    }


    public String getInvoiceNo() {
        return invoiceNo;
    }

    public void setInvoiceNo(String invoiceNo) {
        this.invoiceNo = invoiceNo;
    }

    public String getInvoiceDate() {
        return invoiceDate;
    }

    public void setInvoiceDate(String invoiceDate) {
        this.invoiceDate = invoiceDate;
    }

    public int getProInvoiceLineItemId() {
        return proInvoiceLineItemId;
    }

    public void setProInvoiceLineItemId(int proInvoiceLineItemId) {
        this.proInvoiceLineItemId = proInvoiceLineItemId;
    }

    public int getLineItemId() {
        return lineItemId;
    }

    public void setLineItemId(int lineItemId) {
        this.lineItemId = lineItemId;
    }

    public int getSalesOrderId() {
        return salesOrderId;
    }

    public void setSalesOrderId(int salesOrderId) {
        this.salesOrderId = salesOrderId;
    }

    public int getProductId() {
        return productId;
    }

    public void setProductId(int productId) {
        this.productId = productId;
    }

    public int getLineItemNo() {
        return lineItemNo;
    }

    public void setLineItemNo(int lineItemNo) {
        this.lineItemNo = lineItemNo;
    }

    public int getPoLineItemNo() {
        return poLineItemNo;
    }


    public int getTotalInvoicedQty() {
        return totalInvoicedQty;
    }

    public void setTotalInvoicedQty(int totalInvoicedQty) {
        this.totalInvoicedQty = totalInvoicedQty;
    }

    public void setPoLineItemNo(int poLineItemNo) {
        this.poLineItemNo = poLineItemNo;
    }

    public int getQuantity() {
        return quantity;
    }

    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }


    public int getQtyPulled() {
        return qtyPulled;
    }

    public void setQtyPulled(int qtyPulled) {
        this.qtyPulled = qtyPulled;
    }

    public int getQtyAvailable() {
        return qtyAvailable;
    }

    public void setQtyAvailable(int qtyAvailable) {
        this.qtyAvailable = qtyAvailable;
    }

    public float getUnitPrice() {
        return unitPrice;
    }

    public void setUnitPrice(float unitPrice) {
        this.unitPrice = unitPrice;
    }

    public float getAmount() {
        return amount;
    }

    public void setAmount(float amount) {
        this.amount = amount;
    }

    public double getUnitPriceAsDouble() {
        return unitPriceAsDouble;
    }

    public void setUnitPriceAsDouble(double unitPriceAsDouble) {
        this.unitPriceAsDouble = unitPriceAsDouble;
    }

    public double getAmountAsDouble() {
        return amountAsDouble;
    }

    public void setAmountAsDouble(double amountAsDouble) {
        this.amountAsDouble = amountAsDouble;
    }

    public double getDiscountPrice() {
        return discountPrice;
    }

    public void setDiscountPrice(double discountPrice) {
        this.discountPrice = discountPrice;
    }

    public double getDiscountAmount() {
        return discountAmount;
    }

    public void setDiscountAmount(double discountAmount) {
        this.discountAmount = discountAmount;
    }

    public String getSalesOrderNo() {
        return salesOrderNo;
    }

    public void setSalesOrderNo(String salesOrderNo) {
        this.salesOrderNo = salesOrderNo;
    }

    public String getLabelNumber() {
        return labelNumber;
    }

    public void setLabelNumber(String labelNumber) {
        this.labelNumber = labelNumber;
    }

    public String getMarketingPartNo() {
        return marketingPartNo;
    }

    public void setMarketingPartNo(String marketingPartNo) {
        this.marketingPartNo = marketingPartNo;
    }

    public String getManufacturingPartNo() {
        return manufacturingPartNo;
    }

    public void setManufacturingPartNo(String manufacturingPartNo) {
        this.manufacturingPartNo = manufacturingPartNo;
    }

    public String getLineItemDescription() {
        return lineItemDescription;
    }

    public void setLineItemDescription(String lineItemDescription) {
        this.lineItemDescription = lineItemDescription;
    }

    public String getRequestDate() {
        return requestDate;
    }

    public void setRequestDate(String requestDate) {
        this.requestDate = requestDate;
    }

    public String getBookingDate() {
        return bookingDate;
    }

    public void setBookingDate(String bookingDate) {
        this.bookingDate = bookingDate;
    }

    public String getScheduleDate() {
        return scheduleDate;
    }

    public void setScheduleDate(String scheduleDate) {
        this.scheduleDate = scheduleDate;
    }

    public String getRevisedDate() {
        return revisedDate;
    }

    public void setRevisedDate(String revisedDate) {
        this.revisedDate = revisedDate;
    }

    public String getShippedDate() {
        return shippedDate;
    }

    public void setShippedDate(String shippedDate) {
        this.shippedDate = shippedDate;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getCustomerPO() {
        return customerPO;
    }

    public void setCustomerPO(String customerPO) {
        this.customerPO = customerPO;
    }

    public String getCustomerName() {
        return customerName;
    }

    public void setCustomerName(String customerName) {
        this.customerName = customerName;
    }

    public String getUom() {
        return uom;
    }

    public void setUom(String uom) {
        this.uom = uom;
    }

    public String getEccn() {
        return eccn;
    }

    public void setEccn(String eccn) {
        this.eccn = eccn;
    }

    public String getLicenseException() {
        return licenseException;
    }

    public void setLicenseException(String licenseException) {
        this.licenseException = licenseException;
    }

    public String getCustomerPartNo() {
        return customerPartNo;
    }

    public void setCustomerPartNo(String customerPartNo) {
        this.customerPartNo = customerPartNo;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public boolean isCancel() {
        return cancel;
    }

    public void setCancel(boolean cancel) {
        this.cancel = cancel;
    }

    public boolean isClose() {
        return close;
    }

    public void setClose(boolean close) {
        this.close = close;
    }

    public boolean isHold() {
        return hold;
    }

    public void setHold(boolean hold) {
        this.hold = hold;
    }

    public boolean isTaxable() {
        return taxable;
    }

    public void setTaxable(boolean taxable) {
        this.taxable = taxable;
    }

    public boolean isZeroPrice() {
        return zeroPrice;
    }

    public void setZeroPrice(boolean zeroPrice) {
        this.zeroPrice = zeroPrice;
    }

    public boolean isTransfer() {
        return transfer;
    }

    public void setTransfer(boolean transfer) {
        this.transfer = transfer;
    }


    public boolean isSelected() {
        return selected;
    }

    public void setSelected(boolean selected) {
        this.selected = selected;
    }

    public String getIsTaxableAsString()
    {
        return ( taxable ? "Yes" : "No" );
    }

    public String getUnitPriceAsString()
    {
        return StringUtils.formatAmount( unitPriceAsDouble, "$###,###.###" );
    }

    public String getAmountAsString()
    {
        return StringUtils.formatAmount( amountAsDouble, "$###,###.###" );
    }

    public String getQtyAsString()
    {
        return StringUtils.formatUnits( quantity );
    }

    public String getQtyPulledStr()
    {
        if( qtyPulled == 0 )
        {
            return "";
        }
        else
        {
            return qtyPulled + "";
        }
    }

    public void setQtyPulledStr(String pulledQtyStr)
    {
        if( pulledQtyStr != null &&  pulledQtyStr.trim().length() > 0 )
        {
            try
            {
                qtyPulled = Integer.parseInt( pulledQtyStr );
            }
            catch( NumberFormatException nfe ){  }
        }
        else if( pulledQtyStr == null ||  pulledQtyStr.trim().length() == 0 )
        {
            qtyPulled = 0;
        }
    }
}
